package com.ruoyi.web.task;

import com.ruoyi.common.utils.HttpClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.nio.ByteBuffer;

@Component
@Slf4j
public class CsdnAddVisitTime {
    private int i = 0;

    @Scheduled(fixedRate = 180 * 1000)//具体时间间隔，120*1000也就是2分钟执行一次
    void doSomethingWith() {
        String token = "x-hasdk-token";

        String value = "eyJraWQiOiJnaHNtNWx3MmlzUlFITVNOUDRGU0NIaFRPTzJWdkZBTiIsInR5cCI6IkpXVCIsImFsZyI6IkhTMjU2In0.eyJzdWIiOiI2MTYzNjk0Mzk5MTQzNDMyOTYiLCJjbGllbnRfdHlwZSI6MCwiZXhwIjoxNjgyNDI1Nzg2LCJpYXQiOjE2ODI0MTEzODZ9.7DbY0rLjP94qmp_2RrNNpqBd4i" +
                "hx0GcEA1_coKkFQTE";
        long start = System.currentTimeMillis();
        String juc1 = "https://blog.csdn.net/zhenghuishengq/article/details/133957222?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc1,token,value,null);
        String juc2 = "https://blog.csdn.net/zhenghuishengq/article/details/133850545?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc2,token,value,null);
        String juc3 = "https://blog.csdn.net/zhenghuishengq/article/details/133820599?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc3,token,value,null);
        String juc4 = "https://blog.csdn.net/zhenghuishengq/article/details/133788655?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc4,token,value,null);
        String juc5 = "https://blog.csdn.net/zhenghuishengq/article/details/133723652?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc5,token,value,null);
        String juc6 = "https://blog.csdn.net/zhenghuishengq/article/details/133692023?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc6,token,value,null);
        String juc7 = "https://blog.csdn.net/zhenghuishengq/article/details/133629550?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc7,token,value,null);
        String juc8 = "https://blog.csdn.net/zhenghuishengq/article/details/133378623?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc8,token,value,null);
        String juc9 = "https://blog.csdn.net/zhenghuishengq/article/details/133957222?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc9,token,value,null);
        String juc10 = "https://blog.csdn.net/zhenghuishengq/article/details/133343440?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc10,token,value,null);
        String juc11 = "https://blog.csdn.net/zhenghuishengq/article/details/132857564?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc11,token,value,null);
        String juc12 = "https://blog.csdn.net/zhenghuishengq/article/details/132740980?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc12,token,value,null);
        String juc13 = "https://blog.csdn.net/zhenghuishengq/article/details/132543379?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc13,token,value,null);
        String juc14 = "https://blog.csdn.net/zhenghuishengq/article/details/132478786?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc14,token,value,null);
        String juc15 = "https://blog.csdn.net/zhenghuishengq/article/details/132400429?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(juc15,token,value,null);

        String mongo1 = "https://blog.csdn.net/zhenghuishengq/article/details/139505973?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(mongo1,token,value,null);
        String mongo2 = "https://blog.csdn.net/zhenghuishengq/article/details/140302930?spm=1001.2014.3001.5501";
        HttpClientUtil.getMessage(mongo2,token,value,null);



        long end = System.currentTimeMillis();

        ByteBuffer allocate = ByteBuffer.allocate(1024 * 1024);
        allocate.clear();

        i++;
        log.info("==========================访问量增加了" + (i*17) + ";=====所用的时间为:" + (end - start) );

    }
}
